{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib\n",
    "import numpy\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1",
   "metadata": {},
   "outputs": [],
   "source": [
    "matplotlib.style.use('ggplot')\n",
    "matplotlib.rcParams.update({'font.size': 12})\n",
    "matplotlib.rcParams.update({'xtick.labelsize': 'x-large'})\n",
    "matplotlib.rcParams.update({'xtick.major.size': '0'})\n",
    "matplotlib.rcParams.update({'ytick.labelsize': 'x-large'})\n",
    "matplotlib.rcParams.update({'ytick.major.size': '0'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2",
   "metadata": {},
   "outputs": [],
   "source": [
    "CPU_P = [1, 2, 4, 8, 16, 32, 64]\n",
    "CPU_TPS = [2699, 4868, 8043, 12585, 18168, 22394, 25031]\n",
    "GPU_TPS = 15955\n",
    "CPU_eta = [CPU_TPS[i] / (CPU_TPS[0] * CPU_P[i]) for i in range(len(CPU_TPS))]\n",
    "\n",
    "fig = matplotlib.figure.Figure(figsize=(7, 4.32624056*2), dpi=100)\n",
    "ax = fig.add_subplot(2, 1, 1)\n",
    "ax.plot(CPU_P, CPU_TPS, 's', color='C0', label='CPU')\n",
    "ax.hlines(y=GPU_TPS, xmin=1, xmax=64, color='C1', label='GPU')\n",
    "ax.set_xlabel('P')\n",
    "ax.set_ylabel('TPS')\n",
    "ax.legend()\n",
    "\n",
    "ax = fig.add_subplot(2, 1, 2)\n",
    "ax.plot(CPU_P, CPU_eta, 's', color='C0')\n",
    "ax.hlines(y=GPU_TPS / (CPU_TPS[0] * 64), xmin=1, xmax=64, color='C1')\n",
    "ax.set_xlabel('P')\n",
    "ax.set_ylabel('$\\eta$')\n",
    "fig"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3",
   "metadata": {},
   "outputs": [],
   "source": [
    "fig.savefig('../howto/wca-efficiency-2048.svg', bbox_inches='tight', facecolor=(1, 1, 1, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4",
   "metadata": {},
   "outputs": [],
   "source": [
    "CPU_P = [1, 2, 4, 8, 16, 32, 64, 128, 256]\n",
    "CPU_TPS = [36.072, 61.988, 143.25, 281.35, 502.48, 910.58, 1451.5, 2216.1, 2706.8]\n",
    "GPU_TPS = 7276.5\n",
    "CPU_eta = [CPU_TPS[i] / (CPU_TPS[0] * CPU_P[i]) for i in range(len(CPU_TPS))]\n",
    "\n",
    "fig = matplotlib.figure.Figure(figsize=(7, 4.32624056*2), dpi=100)\n",
    "ax = fig.add_subplot(2, 1, 1)\n",
    "ax.plot(CPU_P, CPU_TPS, 's', color='C0', label='CPU')\n",
    "ax.hlines(y=GPU_TPS, xmin=1, xmax=256, color='C1', label='GPU')\n",
    "ax.set_xlabel('P')\n",
    "ax.set_ylabel('TPS')\n",
    "ax.legend()\n",
    "\n",
    "ax = fig.add_subplot(2, 1, 2)\n",
    "ax.plot(CPU_P, CPU_eta, 's', color='C0')\n",
    "ax.hlines(y=GPU_TPS / (CPU_TPS[0] * 64), xmin=1, xmax=256, color='C1')\n",
    "ax.set_xlabel('P')\n",
    "ax.set_ylabel('$\\eta$')\n",
    "fig"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5",
   "metadata": {},
   "outputs": [],
   "source": [
    "fig.savefig('../howto/wca-efficiency-131072.svg', bbox_inches='tight', facecolor=(1, 1, 1, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
